import request from "./request";
//获取验证码
const getcode = (params)=>{
  return request("/user/sendcode", "POST", params)
}
//验证码登录
const login = (params)=>{
  return request("/user/login", "POST", params)
}
//获取聊天列表
const getnewslist = ()=>{
  return request("/news/newslist", "GET")
}
//获取socketid
const getsockertId = (query)=>{
  return request(`/news/getsocket/${query}`, "GET")
}
//获取消息列表
const getnews = (query)=>{
  return request(`/news/newsByuser/${query}`, "GET")
}
//获取商品分类
const getshoptype = ()=>{
  return request(`/shop/getShopType`, "GET")
}
//获取商品列表
const getshoplist = ()=>{
  return request(`/shop/getShopList`, "GET")
}
//获取商品详情
const getShopDetail = (query)=>{
  return request(`/shop/getShopDetail/${query}`, "GET")
}
//创建对话
const creatchat = (params)=>{
  return request(`/shop/createChat`, "POST",params)
}
//获取收货地址
const getaddress = ()=>{
  return request(`/user/getaddress`, "GET")
}
//删除收货地址
const deladdress = (query)=>{
  return request(`/user/deleteaddress/${query}`, "GET")
}
//确认购买生成订单
const createOrder = (params)=>{
  return request(`/shop/createOrder`, "POST",params)
}
//查询订单支付状态
const checkOrderState = (query)=>{
  return request(`/shop/orderStatus/${query}`, "GET")
}
//查询买到的商品订单
const getOrder = (query)=>{
  return request(`/orders/getOrderListBuy/${query}`, "GET")
}
//查询卖出的商品订单
const getOrdersell = (query)=>{
  return request(`/orders/getOrderListSell/${query}`, "GET")
}
//保存地址
const saveaddress = (params)=>{
  return request(`/user/addaddress`, "POST",params)
}
//获取用户发布商品
const getrelease = (query)=>{
  return request(`/orders/getshop/${query}`, "GET")
}
//下架商品
const offShop =(query)=>{
  return request(`/orders/downshop/${query}`, "GET")
}
//发货
const Delivery = (params)=>{
  return request(`/orders/sendgoods`, "POST",params)
}
//去支付
const payorder = (params)=>{
  return request(`/orders/payorder`, "POST",params)
}
//查看物流
const logistics = (params)=>{
  return request(`/orders/logistics`, "POST",params)
}
//确认收货
const confirm = (query)=>{
  return request(`/orders/confirm/${query}`, "GET")
}
//商品留言评论
const shopMessage = (params)=>{
  return request(`/shop/shopMessage`, "POST",params)
}
//获取商品列表通过分类
const getShopListByType = (query) =>{
  return request(`/shop/getShopListByType/${query}`,"GET")
}
//商品搜索
const getShopListByinfo = (params)=>{
  return request(`/shop/getShopListByinfo`, "POST",params)
}
//发布商品
const publishShop = (params)=>{
  return request(`/shop/publish`, "POST",params)
}
export {
  getcode,
  login,
  getnewslist,
  getsockertId,
  getnews,
  getshoptype,
  getshoplist,
  getShopDetail,
  creatchat,
  getaddress,
  deladdress,
  createOrder,
  checkOrderState,
  getOrder,
  getOrdersell,
  saveaddress,
  getrelease,
  offShop,
  Delivery,
  payorder,
  logistics,
  confirm,
  shopMessage,
  getShopListByType,
  getShopListByinfo,
  publishShop
}